package com.example.telesys.service.impl;

import com.example.telesys.mapper.PhoneMapper;
import com.example.telesys.pojo.Phone;
import com.example.telesys.pojo.PhoneExample;
import com.example.telesys.service.PhoneService;
import com.example.telesys.utils.UuidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class PhoneServiceImpl implements PhoneService {
    @Autowired
    private PhoneMapper phoneMapper;

    @Override
    public List<Phone> selectAllPhones() {
        return phoneMapper.selectByExample(null);
    }

    @Override
    public Phone selectPhoneById(String phoneid) {
        PhoneExample phoneExample = new PhoneExample();
        PhoneExample.Criteria criteria = phoneExample.createCriteria();
        criteria.andPhoneidEqualTo(phoneid);
        return phoneMapper.selectByExample(phoneExample).get(0);
    }
}
